package com.zhouheng.springbootmultithreading.module.producerconsumerissues.consumer;

import com.zhouheng.springbootmultithreading.module.producerconsumerissues.service.Storage;

/**
 * 消费者
 *
 * @author 周恒
 * @date 20190107 17:39:05
 * @since v1.0
 */
public class Consumer extends Thread {

    private String consumer;
    private Storage storage;

    public Consumer(String consumer, Storage storage) {
        this.consumer = consumer;
        this.storage = storage;
    }

    @Override
    public void run() {
        consume();
    }

    public void consume() {
        storage.consume(this.consumer);
    }

}
